Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove reliance on remote backend #17

Merged
merged 1 commit into from
Nov 24, 2022
Merged

Conversation

dms1981
Copy link
Contributor

@dms1981 dms1981 commented Nov 23, 2022

Relevant Issue: ministryofjustice/modernisation-platform#2647

Because the infrastructure created by terratest code is transient and to minimise the overhead of managing additional terraform state, the terratest code is being shifted to use local backend that doesn't persist the state between runs. The change makes the use of terraform workspaces irrelevant.

  • Update go-terratest workflow to remove the code explicitly selecting a workspace
  • Update README.md in the test folder to remove references to terraform workspaces
  • Update go code to remove set workspace command and merge Init + Apply back into one statement
  • Remove backend.tf from unit-test code
  • Update providers.tf to remove references to terraform.workspace
    Additionally some minor changes for consistency and neatness.

@dms1981 dms1981 requested a review from a team as a code owner November 23, 2022 16:52
@github-actions
Copy link
Contributor

TFSEC Scan Success

Show Output
*****************************

TFSEC will check the following folders:
.

*****************************

Running TFSEC in .
Excluding the following checks: AWS089, AWS099, AWS009, AWS097, AWS018
  timings
  ──────────────────────────────────────────
  disk i/o             159.4µs
  parsing              548.755215ms
  adaptation           291.699µs
  checks               17.064576ms
  total                566.27089ms

  counts
  ──────────────────────────────────────────
  modules downloaded   1
  modules processed    2
  blocks processed     65
  files read           8

  results
  ──────────────────────────────────────────
  passed               12
  ignored              5
  critical             0
  high                 0
  medium               0
  low                  0


No problems detected!

tfsec_exitcode=0

Checkov Scan Success

Show Output
*****************************

Checkov will check the following folders:
.

*****************************

Running Checkov in .
Excluding the following checks: CKV_GIT_1
2022-11-23 16:54:59,495 [MainThread  ] [WARNI]  Failed to download module github.com/ministryofjustice/modernisation-platform-terraform-s3-bucket?ref=v6.2.0:None (for external modules, the --download-external-modules flag is required)
Process ForkProcess-11:
Traceback (most recent call last):
  File "/usr/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap
    self.run()
  File "/usr/lib/python3.7/multiprocessing/process.py", line 99, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.7/dist-packages/checkov/common/parallelizer/parallel_runner.py", line 37, in func_wrapper
    result = original_func(item)
  File "/usr/local/lib/python3.7/dist-packages/checkov/common/runners/runner_registry.py", line 89, in _parallel_run
    collect_skip_comments=collect_skip_comments,
  File "/usr/local/lib/python3.7/dist-packages/checkov/github/runner.py", line 34, in run
    self.prepare_data()
  File "/usr/local/lib/python3.7/dist-packages/checkov/github/runner.py", line 43, in prepare_data
    self.github.persist_all_confs()
  File "/usr/local/lib/python3.7/dist-packages/checkov/github/dal.py", line 137, in persist_all_confs
    self.persist_branch_protection_rules()
  File "/usr/local/lib/python3.7/dist-packages/checkov/github/dal.py", line 69, in persist_branch_protection_rules
    BaseVCSDAL.persist(path=self.github_branch_protection_rules_file_path, conf=data)
  File "/usr/local/lib/python3.7/dist-packages/checkov/common/vcs/base_vcs_dal.py", line 113, in persist
    BaseVCSDAL.ensure_dir(path)
  File "/usr/local/lib/python3.7/dist-packages/checkov/common/vcs/base_vcs_dal.py", line 123, in ensure_dir
    os.makedirs(directory_path)
  File "/usr/lib/python3.7/os.py", line 221, in makedirs
    mkdir(name, mode)
FileNotFoundError: [Errno 2] No such file or directory: ''
terraform scan results:

Passed checks: 23, Failed checks: 0, Skipped checks: 2

github_actions scan results:

Passed checks: 123, Failed checks: 0, Skipped checks: 0


checkov_exitcode=0

CTFLint Scan Success

Show Output
*****************************

Setting default tflint config...
Running tflint --init...
Installing `terraform` plugin...
Installed `terraform` (source: github.com/terraform-linters/tflint-ruleset-terraform, version: 0.2.1)
tflint will check the following folders:
.

*****************************

Running tflint in .
tflint_exitcode=0

@dms1981 dms1981 merged commit caa3b1f into main Nov 24, 2022
@dms1981 dms1981 deleted the feature/remove-test-backends-2647 branch November 24, 2022 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants